<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			
			var txuePrice = 245;
			var txueCount = 2;
			var shoePrice = 570;
			var shoeCount = 10;
			var paiPrice = 320;
			var paiCount= 1;
			//折扣
			var discount =0.8;
			//用户实际付款金额
			var userMoney= 5300;
			
			
			document.write("<table width='300'>");
			
			document.write("<tr>");
			document.write("<td colspan='4' align='center'>");
			document.write("********消费单********");
			document.write("</td>")	;
			document.write("</tr>");
			
			document.write("<tr>");
			document.write("<td>购买物品</td>");
			document.write("<td>单价</td>");
			document.write("<td>数量</td>");
			document.write("<td>金额</td>");
			document.write("</tr>");
			
			document.write("<tr>");
			document.write("<td> T恤</td>");
			document.write("<td>&yen;"+txuePrice+"</td>");
			document.write("<td>"+txueCount+"</td>")
			document.write("<td>&yen;"+(txuePrice*txueCount)+"</td>")
			document.write("</tr>");
			
			document.write("<tr>");
			document.write("<td>网球鞋</td>");
			document.write("<td>&yen;"+shoePrice+"</td>");
			document.write("<td '>"+shoeCount+"</td>")
			document.write("<td>&yen;"+(shoeCount*shoePrice)+"</td>")
			document.write("</tr>");
			
			document.write("<tr>");
			document.write("<td>网球拍</td>");
			document.write("<td>&yen;"+paiPrice+"</td>");
			document.write("<td '>"+paiCount+"</td>")
			document.write("<td>&yen;"+(paiCount*paiPrice)+"</td>")
			document.write("</tr>");
			
			document.write("<tr>");
			document.write("<td colspan='4'align='center'></td>");
			document.write("&nbsp;");
			document.write("</tr>");
			
			
			document.write("<tr>");
			document.write("<td>");
			document.write("折扣：")
			document.write("<td colspan='3'>");
			document.write(discount*10+"折")
			
			document.write("</td>");
			document.write("</td>");
			document.write("</tr>");
			
			document.write("<tr>");
			document.write("<td>");
			document.write("消费金额：");
			document.write("</td>");
			document.write("<td colspan='3'>");
			var totalPrice =txueCount*txuePrice+shoeCount*shoePrice+paiCount*paiPrice;
			
			document.write("&yen;"+totalPrice*discount);
			document.write("</td>");
			document.write("</tr>");
			
			document.write("<tr>");
			document.write("<td>");
			document.write("实际消费：");
			document.write("</td>");
			document.write("<td colspan='3'>");
			document.write("&yen;"+userMoney);
			document.write("</td>");
			document.write("</tr>");
			
			
			document.write("<tr>");
			document.write("<td>");
			document.write("找零：");
			document.write("</td>");
			document.write("<td colspan='3'>");
			document.write("&yen;"+(userMoney-totalPrice*discount));
			document.write("</td>");
			document.write("</tr>");
			document.write("</table>");
			
		</script>
	</body>
</html>
